package org.spring.autoType.service;

import org.spring.autoType.config.AutoTypeConfigure;
import org.spring.autoType.utils.TypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author LHB
 * @date 2019/12/24 14:42
 */
@EnableScheduling
@Component
public class Test {
    @Autowired
    private AutoTypeConfigure typeConfigure;

    @Scheduled(cron = "0/10 * * * * ?")
    public void test() {
        try {

            ProcessorAdapter processorAdapter = typeConfigure.getAdapter("文本");
            processorAdapter.doExecuteProcessor();
            ProcessorAdapter processorAdapter2 = typeConfigure.getAdapter("图片");
            processorAdapter2.doExecuteProcessor();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
